﻿using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using XiaoChenDateAndTimeTool.xiaochenDtTool;

namespace XiaoChenDateAndTimeTool
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private xcDtTool xct = new xcDtTool();

        public MainWindow()
        {
            InitializeComponent();
            inputTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            outputTime.Text = DateTime.Parse(inputTime.Text).AddHours(8).ToString("yyyy-MM-dd HH:mm:ss");
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DateTime t1 = new DateTime();

            try
            {
                t1 = DateTime.Parse(inputTime.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show("转换出错，请检查日期格式");
            }
            
            //var t2 = t1.AddHours(8);
            var t2 = xct.TiemAddHours(t1, 8);
            outputTime.Text = t2.ToString("yyyy-MM-dd HH:mm:ss");
            MessageBox.Show("时间转换完毕");
        }


    }
}